package com.kuang.unsafe;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;

public class MapTest {
    public static void main(String[] args) {
        //map是这样用的么?默认等价于什么?new HashMap<>(16,0.75);
        //HashMap<String, String> map = new HashMap<>();
//        Map<String,String> map = new ConcurrentHashMap<>();
        Map<String,String> map = Collections.synchronizedMap(new HashMap<>());
        for (int i = 0; i < 30; i++) {
            new Thread(() -> {
                map.put(Thread.currentThread().getName(), UUID.randomUUID().toString().substring(0,5));
                System.out.println(map);
            }, String.valueOf(i)).start();
        }
        //加载因子,初始化容量
    }
}
